{# 任务提示模版 #}
<user_prompt version="1">
<message from="user">
{{ instruction }}
</message>

<planning_phase>
For any complex request, your first and most important step is to create a detailed execution plan.

1.  **Create the Plan:** The plan must be a Markdown TODO list.
2.  **Format the Plan:** You MUST encapsulate the plan within a code block with the name `todo` and path `todo.md`.
    Example:
    <!-- Block-Start: {"name": "todo", "path": "todo.md"} -->
    ```markdown
    - [ ] TODO 1: Analyze the requirements.
    - [ ] TODO 2: Research library options using a SubTask.
    - [ ] TODO 3: Implement the core logic.
    - [ ] TODO 4: Write unit tests.
    ```
    <!-- Block-End: {"name": "todo"} -->
3.  **Execute Autonomously:** After defining the plan, you will immediately begin executing it step-by-step. You do not need to wait for user confirmation.
4.  **Use SubTasks for Complex Steps:** For any step in your plan that involves research, deep analysis, or complex, isolated code generation, you should delegate that step to a `SubTask`.
</planning_phase>

{% if contexts is defined and contexts %}
<context>
{% for key, value in contexts.items() %}
- {{ key }}: {{ value }}
{% endfor %}
</context>
{% endif %}

<constraints>
- File creation path: current_directory
{% if gui %}
- DO NOT use plt.show to display picture because I'm using the Agg backend. Save pictures with plt.savefig() and display them with utils.display().
{% endif %}
{% if constraints is defined and constraints %}
{% if constraints.lang is defined and constraints.lang %}
{% if constraints.lang == 'zh' %}
- 除非用户明确指定，思考过程和最终回复都必须使用中文，不管用户输入内容是什么语言。
{% else %}
- Your response should match the language of the user's input.
{% endif %}
{% endif %} 
{% endif %}
</constraints>

{% if parent is defined and parent %}
<parent_task>
This task is a subtask of the following parent task. Consider the context of the parent task when generating your response.

- Task ID: {{ parent.task_id }}
- Instruction: {{ parent.instruction }}

And, you **SHOULD** generate a final response with enough information for the parent task to understand the progress of this subtask.

</parent_task>
{% endif %}
</user_prompt>